package com.hd.crdao.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.hd.crdao.R;
import com.hd.crdao.utils.UIUtils;

/**
 *
 *@author Administrator
 *@date 2017/7/13 0013
 */
public class DomainHisAdapter extends BaseAdapter{
   private String[]  split;

    public DomainHisAdapter(String[] split) {
        this.split = split;
    }

    @Override
    public int getCount() {
        return split.length;
    }

    @Override
    public Object getItem(int position) {
        return split[position];
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder;
        if(convertView==null){
            viewHolder = new ViewHolder();
            convertView= View.inflate(UIUtils.getContext(), R.layout.item_domainhis, null);
            viewHolder.mTextView = (TextView) convertView.findViewById(R.id.item_tv);
            convertView.setTag(viewHolder);
        }else{
            viewHolder = (ViewHolder) convertView.getTag();
        }
        viewHolder.mTextView.setText(String.format("%s.crdcar.com", split[position]));
        return convertView;
    }

    class ViewHolder{
        TextView mTextView;
    }
}
